import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Index from '../views/Index.vue'
import Shop from '../views/Shop.vue'
import List from '../views/List.vue'
import My from '../views/My.vue'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    children: [
      {
        path: '/index',
        name: 'Index',
        component: Index,
      },
      {
        path: '/home',
        name: 'Home',
        component: Home,
        title: '页面',
      },
      {
        path: '/shop',
        name: 'Shop',
        component: Shop,
        title: '购物车',
      },
      {
        path: '/list',
        name: 'List',
        component: List,
        title: '购物车',
      },
      {
        path: '/my',
        name: 'My',
        component: My,
        title: '我的',
      },
    ]
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
